import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-10-05
 * Time: 12:06
 */
public class IODemo11 {
    public static void main(String[] args) throws FileNotFoundException {
        try{
            //打开操作会把原有文件中的内容清空，所以罪魁祸首不是Write操作而是打开操作
            OutputStream outputStream = new FileOutputStream("./test.txt");
            //OutputStream outputStream = new FileOutputStream("./test.txt",true);追加写
            byte[] buffer = new byte[]{97,98,99,100,101};
            outputStream.write(buffer);

        }catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
